<template>
  <div>
   <common-head title="添加联系人"/>
   <div class="wrap">
    <van-address-edit
      :area-list="area"
      show-postal
      show-set-default
      :area-columns-placeholder="['请选择', '请选择', '请选择']"
      @save="onSave"
    />
   </div>
  </div>
</template>

<script>
import CommonHead from '../../components/CommonHead.vue'
import area from '@/utils/area'
export default {
  data () {
    return {
      area
    }
  },
  methods: {
    onSave (contact) {
      // console.log(contact)
      contact.id = Date.now()
      contact.address = contact.province + contact.city + contact.county + contact.addressDetail
      this.$store.commit('contact/add_contact', contact)
      // 回到联系人列表
      this.$router.replace('/contactList')
    }
  },
  components: {
    CommonHead
  }
}
</script>

<style lang="scss" scoped>
.wrap{
  margin-top: 46px;
}
</style>
